require 'test/unit'
require 'semantictext/date_extractor'

class TestDateExtractor< Test::Unit::TestCase

	def testExtractDateFromHappyString
		unit = SemanticText::DateExtractor.new
		result = unit.extract_from('5 November 2005')
		assert_equal 5, result.day
		assert_equal 11, result.month
		assert_equal 2005, result.year
		assert_equal Time, result.class
	end

	def testExtractRejectsInvalidMonth
		unit = SemanticText::DateExtractor.new
		assert_throws(:"SemanticText::ExtractionFailed") { unit.extract_from('5 x 2005')}
	end
end
